/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Date;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;

/**
 *
 * @author Dao Thai Duy
 */
@Entity
public class RedemptionListEntity implements Serializable {
    private static long serialVersionUID = 1L;

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public static void setSerialVersionUID(long aSerialVersionUID) {
        serialVersionUID = aSerialVersionUID;
    }
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private String name;
    private String description;
    private int maxQuantity;
    private double pointCost;
    private boolean visibility = true;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date validFrom;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date dateCreated;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date validUntil;
    @OneToMany(mappedBy="redemptionList")
    private List<RedemptionItemEntity> redemptionItem= new ArrayList<RedemptionItemEntity>();

    public RedemptionListEntity() {        
    }
    
    public RedemptionListEntity(RedemptionListEntity list) {
       this.name = list.getName();
       this.description = list.getDescription();
       this.maxQuantity = list.getMaxQuantity();
       this.pointCost = list.getPointCost();
       this.validFrom = list.getValidFrom();
       this.validUntil = list.getValidUntil();
       this.dateCreated = new Date();  
       this.visibility = list.isVisibility();
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public int getMaxQuantity() {
        return maxQuantity;
    }

    public void setMaxQuantity(int maxQuantity) {
        this.maxQuantity = maxQuantity;
    }

    public double getPointCost() {
        return pointCost;
    }

    public void setPointCost(double pointCost) {
        this.pointCost = pointCost;
    }

    public Date getValidFrom() {
        return validFrom;
    }

    public void setValidFrom(Date validFrom) {
        this.validFrom = validFrom;
    }

    public Date getDateCreated() {
        return dateCreated;
    }

    public void setDateCreated(Date dateCreated) {
        this.dateCreated = dateCreated;
    }

    public Date getValidUntil() {
        return validUntil;
    }

    public void setValidUntil(Date validUntil) {
        this.validUntil = validUntil;
    }

    public List<RedemptionItemEntity> getRedemptionItem() {
        return redemptionItem;
    }

    public void setRedemptionItem(ArrayList<RedemptionItemEntity> redemptionItem) {
        this.redemptionItem = redemptionItem;
    }

    public boolean isVisibility() {
        return visibility;
    }

    public void setVisibility(boolean visibility) {
        this.visibility = visibility;
    }

    
}
